cmake_minimum_required(VERSION 3.10)

PROJECT(TCL_Depth_SDK CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

#if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s -O3 -fpic")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s -O3 -fpic")
#include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
#elseif(${ANDROID_ABI} STREQUAL "arm64-v8a")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s -O3 -fpic")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s -O3 -fpic")
#include_directories(${ANDROID_SYSROOT}/usr/include/aarch64-linux-android)
#else()
#include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
#endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/libs/)

################## CONFIGURATION ZONE BEGIN ##################
# opencv-4.1.1
set(OpenCV_DIR "/usr/local/lib/cmake/opencv4/")
# AI vision engine by ZhangWei, 2020/12/22
set(MNN_LIB_PATH "/home/hiroki/mnn/build/libMNN.a")
set(VISION_ENGINE_PATH "${CMAKE_SOURCE_DIR}/libVisionEngine.a")
# AI portrait segmentation model
set(PORTRAIT_MODEL_PATH "/home/hiroki/portrait/model_converter")
# Switch on or off to enable or disable detailed module logging
option(PERFORMANCE_ANALYSIS "enable or disable detailed logging" ON)
################## CONFIGURATION ZONE END ####################

find_package(OpenCV REQUIRED core calib3d imgproc imgcodecs features2d ximgproc optflow)
if(OpenCV_FOUND)
    include_directories(${OpenCV_INCLUDE_DIRS})
    message(STATUS "OpenCV library status:")
    message(STATUS "    version: ${OpenCV_VERSION}")
    message(STATUS "    libraries: ${OpenCV_LIBS}")
    message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")
else(OpenCV_FOUND)
    message(FATAL_ERROR "OpenCV library not found")
endif(OpenCV_FOUND)

# import MNN lib
#add_library(libVisionEngine STATIC IMPORTED)
#set_target_properties(libVisionEngine PROPERTIES
#  IMPORTED_LOCATION ${VISION_ENGINE_PATH})
#link_libraries(${VISION_ENGINE_PATH} ${MNN_LIB_PATH} ${OpenCV_LIBRARIES})

add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(mnn_test)
